package com.ssy.lingxi.marketing.model.constant;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 平台优惠券领取方式枚举
 * @author yzc
 * @version 2.0.0
 * @date 2021/6/28
 */
public enum PlatformCouponGetWayEnum {

    /**
     * 前台用户领券 - 1
     */
    FRONT(1, "前台用户领券"),

    /**
     * 指定会员发券 - 2
     */
    APPOINT(2, "指定会员发券"),

    /**
     * 营销活动用券 - 3
     */
    MARKETING(3, "营销活动用券"),

    /**
     * 会员运营用券 - 4
     */
    operation(4, "会员运营用券");


    private final Integer code;
    private final String message;

    PlatformCouponGetWayEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static String getCodeMessage(Integer code) {
        PlatformCouponGetWayEnum status = Arrays.stream(PlatformCouponGetWayEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
        return status == null ? "未知" : status.getMessage();
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

}